package com.turing.post.cardmanagement.util;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 卡ATS信息表
 * 
 * @author kangzhe
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "CARDATS")
@IdClass(CardATS.class)
public class CardATS implements Serializable {

	/**
	 * CPU卡ATS号
	 */
	private String ATS;

	@Id
	@Column(name = "ATS", nullable = false)
	public String getATS() {
		return ATS;
	}

	public void setATS(String ats) {
		ATS = ats;
	}

	/**
	 * 卡号
	 */
	private String cardNo;

	@Id
	@Column(name = "CARDNO", nullable = false)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	/**
	 * 卡顺序号
	 */
	private String cardSeqNo;

	@Id
	@Column(name = "CARDSEQNO", nullable = false)
	public String getCardSeqNo() {
		return cardSeqNo;
	}

	public void setCardSeqNo(String cardSeqNo) {
		this.cardSeqNo = cardSeqNo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getATS() == null) ? 0 : getATS().hashCode());
		result = prime * result
				+ ((getCardNo() == null) ? 0 : getCardNo().hashCode());
		result = prime * result
				+ ((getCardSeqNo() == null) ? 0 : getCardSeqNo().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final CardATS other = (CardATS) obj;
		if (getATS() == null) {
			if (other.getATS() != null)
				return false;
		} else if (!getATS().equals(other.getATS()))
			return false;
		if (getCardNo() == null) {
			if (other.getCardNo() != null)
				return false;
		} else if (!getCardNo().equals(other.getCardNo()))
			return false;
		if (getCardSeqNo() == null) {
			if (other.getCardSeqNo() != null)
				return false;
		} else if (!getCardSeqNo().equals(other.getCardSeqNo()))
			return false;
		return true;
	}
}
